<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateViewLogTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('view_log', function (Blueprint $table) {
            $table->increments('id')->comment('自增ID');
            $table->unsignedTinyInteger('app_type')->default('0')->comment('应用类型：1电脑网站、2微信公众号、3微信小程序、4app等，来源数据字典appTypeVar');
            $table->string('domain', 50)->default('')->comment('域名');
            $table->unsignedInteger('member_id')->default('0')->comment('会员ID');
            $table->string('session_id')->default('')->comment('session_id');
            $table->string('referer', 500)->default('')->comment('来源地址');
            $table->string('request_uri', 500)->default('')->comment('请求地址');
            $table->string('request_method', 50)->default('')->comment('请求方法');
            $table->string('request_parameters', 5000)->default('')->comment('请求参数');
            $table->string('request_ip', 50)->default('')->comment('请求ip');
            $table->string('request_browser', 50)->default('')->comment('客户端浏览器');
            $table->string('request_browser_version', 50)->default('')->comment('客户端浏览器版本');
            $table->string('request_platform', 50)->default('')->comment('客户端设备操作系统');
            $table->string('request_platform_version', 50)->default('')->comment('客户端设备系统版本');
            $table->timestamp('created_at')->nullable()->comment('创建时间');
            $table->softDeletes()->comment('删除时间');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('view_log');
    }
}
